import {Content} from './content'
import React, {useEffect, useState} from 'react'
import {useParams} from "react-router-dom";
import {getArticle} from "../api/article";
import {Col, Row} from "antd";

export function Article() {
    return <Blog/>
}

//Blog Item
export function Blog() {
    //拿到路由参数
    const {blog_id} = useParams()
    //文章实体
    const [article, setArticle] = useState({})
    //查询该id的文章
    useEffect(() => {
        getArticle(blog_id).then(res => {
            setArticle({...res.data.data})
        })
    }, [])
    return (
        <div>
            <Row justify={"center"}>
                <Col span={10}>
                    <Content BlogInfo={article}/>
                </Col>
            </Row>
        </div>
    )
}
